package com.example.happiness.controller.user;

import com.example.happiness.pojo.Chat;
import com.example.happiness.result.Result;
import com.example.happiness.service.user.UserChatService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api(tags = "聊天相关接口")
@Slf4j
@RestController
@RequestMapping("/user/chat")
public class UserChatController {

    @Autowired
    UserChatService userChatService;

    @GetMapping("/getChat")
    @ApiOperation("获取聊天记录")
    public Result<List<Chat>> getChat(String userid){
        List<Chat> chats = userChatService.getChat(userid);
        return Result.success(chats);
    }
}
